package cn.ratel.route.render;

import cn.ratel.kit.StrKit;
import cn.ratel.route.ContextHolder;

import java.util.Map;

/**
 * author iver
 */
public class Tpl {
	private String path;
	private Map<String, Object> variable;

	public Tpl(String path) {
		this.path = path;
	}

	public Tpl(Map<String, Object> variable) {
		this.variable = variable;
	}

	public Tpl(String path, Map<String, Object> variable) {
		this.path = path;
		this.variable = variable;
	}

	public String getPath() {
		if (StrKit.isBlank(path)) {
			return ContextHolder.getUri().get();
		}
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public Map<String, Object> getVariable() {
		return variable;
	}

	public void setVariable(Map<String, Object> variable) {
		this.variable = variable;
	}
}
